<?php
// autor Jiří Němec <nemec.jiri@gmail.com>
header('Content-type: text/css');
header("Cache-Control: must-revalidate");
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 60*60*24*2)." GMT");

$gz = false;
if (!ini_get('zlib.output_compression') && ereg('gzip',$_SERVER['HTTP_ACCEPT_ENCODING']) && !(eregi('msie',$_SERVER['HTTP_USER_AGENT']))) $gz = true;
if ($gz) ob_start("ob_gzhandler");
if ($gz) echo '/* komprese zapnuta */';
foreach ($_GET as $key => $val){
 if ($key == 'menu'){
  include('../menu.php');
  foreach ($menuA as $key => $val){
   echo 'A#menu-'.$key.' {margin-left:1px;float:left;border: 0;background:url(../img/menu-'.$key.'.png);width: '.$val.'px;}'.
   ' A#menu-'.$key.':hover {background-position: 0px 37px;}';
  }
 }
 elseif(file_exists($key.'.css')) {
  $buffer = file_get_contents($key.'.css');
  if (!ereg('MSIE [56].',$_SERVER["HTTP_USER_AGENT"])) $buffer = ereg_replace('<ie6[^>]+>','',$buffer);
  $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
  $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
  
  echo($buffer);

 }
}
if ($gz) ob_end_flush();
?>
